package org.elte.lipika.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.elte.lipika.Terminus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/statistic/**")
@Controller
public class StatisticController {

    @RequestMapping(method=RequestMethod.GET,params={"terminus"})
    public String get(ModelMap modelMap, HttpServletRequest request, HttpServletResponse response, @RequestParam(required=true) long terminus) {
    	modelMap.addAttribute("terminus", Terminus.findTerminus(terminus));
    	 return "terminus/show";
    }

    @RequestMapping(method = RequestMethod.POST, value = "{id}")
    public void post(@PathVariable Long id, ModelMap modelMap, HttpServletRequest request, HttpServletResponse response) {
    }

    @RequestMapping
    public String index() {
        return "statistic/index";
    }
}
